// pages/welcome/welcome.js
import {postList} from '../../data/data.js'
Page({

  /**
   * 页面的初始数据
   */
  data: {
    a: "This is my data."
  },

  onGoToDetail(options) {
    console.log('/pages/post-detail/post-detail?id=' + options.currentTarget.dataset["id"])
    wx.navigateTo({
      url: '/pages/post-detail/post-detail?id=' + options.currentTarget.dataset["id"],
    })
  },

  onTap(options) {
    console.log('...start')
    console.log(options)
    console.log('...end')
    wx.navigateTo({
      url: '/pages/demo/demo',
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log("onLoad is called.")

    this.setData({
      myPosts: postList
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    console.log("onReady is called.")
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    console.log("onShow is called.")
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
    console.log("onHide is called.")
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
    console.log("onUnload is called.")
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    console.log("onPullDownRefresh is called.")
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    console.log("onReachBottom is called.")
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    console.log("onShareAppMessage is called.")
  }
})